package com.micrograils.gormwithspringboot.service

import com.micrograils.gormwithspringboot.domain.Person
import grails.gorm.transactions.Transactional
import org.springframework.stereotype.Component

@Component
class PersonService {

    @Transactional
    def sayHelloTo(String name) {
        new Person(name: name, age: new Date().getTime() % 100).save()
        println "hello ${name}, you are ${Person.get(1).age} years old."
    }
}
